<?php

/**
 * O2O团购PC版本
 * ============================================================================
 * * 版权所有 2009-2016 郑州司科计算机科技有限公司，并保留所有权利。
 * 购买网址: http://www.jzphp.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
  * 咨询电话：400-823-0371 QQ：313999875
 * ============================================================================
 * $Author: zzsike $
 * $Time 2016-02-03 sammy $
*/


require_once(dirname(dirname(dirname(__FILE__))) . '/app.php');

need_manager();
need_auth('order');

$condition = array(
	'state' => 'pay',
	'allowrefund' => 'Y',
	'rstate' => 'askrefund',
	'team_id > 0',
);

$count = Table::Count('order', $condition);
list($pagesize, $offset, $pagestring) = pagestring($count, 20);

$orders = DB::LimitQuery('order', array(
	'condition' => $condition,
	'order' => 'ORDER BY pay_time DESC, id DESC',
	'size' => $pagesize,
	'offset' => $offset,
));
/*代理商登录*/
$conditions = array(
	'state' => 'pay',
	'allowrefund' => 'Y',
	'city_id'=>$login_user[city_id],
	'rstate' => 'askrefund',
	'team_id > 0',
);

$counts = Table::Count('order', $conditions);
list($pagesize, $offset, $pagestrings) = pagestring($counts, 20);

$orderss = DB::LimitQuery('order', array(
	'condition' => $conditions,
	'order' => 'ORDER BY pay_time DESC, id DESC',
	'size' => $pagesize,
	'offset' => $offset,
));
/*end*/
$pay_ids = Utility::GetColumn($orders, 'pay_id');
$pays = Table::Fetch('pay', $pay_ids);

$user_ids = Utility::GetColumn($orders, 'user_id');
$users = Table::Fetch('user', $user_ids);

$team_ids = Utility::GetColumn($orders, 'team_id');
$teams = Table::Fetch('team', $team_ids);


include template('manage_order_refund');
